<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        var nums = [0,1,0,3,12]
        var moveZeroes = function(nums) {
            let index = 0
            for(let i=0;i<nums.length;i++){
                if(nums[i]!=0){
                    nums[index++] = nums[i]
                }
            }
            for(index;index<nums.length;index++){
                nums[index] = 0
            }
            return nums;
        };
        console.log(moveZeroes(nums));
    </script>
</body>
</html>